﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.CUiConsumeForm
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using C1.Win.C1FlexGrid;
using DnProcessSimulateCommands.AssignDataFromTC;
using EngineeringInternalExtension;
using EngineeringInternalExtension.Utilities;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using Tecnomatix.Engineering;
using Tecnomatix.Engineering.Ui;
using Tecnomatix.Engineering.Ui48;
using Tecnomatix.Engineering.Utilities;
using Tecnomatix.Planning;


namespace DnProcessSimulateCommands;

internal class CUiConsumeForm : TxForm
{
  private IEnumerable<CUiTCObjectProperty> _selectedProperties;
  private IEnumerable<CUiSearchResultObject> _objectsForConsumption;
  private CApAssignDataFromTCApp _application;
  private bool _resourcesMode;
  private ITxValidator _pickValidator;
  private ITxValidator _targetScopeValidator;
  private bool _isTargetScopeSelected;
  private bool _isProcessSelected;
  private IContainer components;
  private TxObjEditBoxCtrl _txObjEditBoxCtrl;
  private Label label1;
  private Button _buttonOK;
  private Button _buttonCancel;
  private TxFlexGrid _txFlexGrid;
  private Label _labelObjectsForConsumption;
  private TxObjEditBoxCtrl _txObjEditBoxCtrlTargetScope;
  private Label _labelTargetScope;

  internal CUiConsumeForm(
    IEnumerable<CUiSearchResultObject> objectsForConsumption,
    IEnumerable<CUiTCObjectProperty> selectedProperties,
    CApAssignDataFromTCApp application,
    bool resourceMode)
  {
    this._objectsForConsumption = objectsForConsumption;
    this._selectedProperties = selectedProperties;
    this._application = application;
    this._resourcesMode = resourceMode;
    this._pickValidator = (ITxValidator) new TcOperationProcessvalidator(this, new CUiConsumeForm_ValidateSelectionDelegate(this.ValidateTargetProcessSelection));
    this._targetScopeValidator = (ITxValidator) new TcWorkAreaValidator(this, new CUiConsumeForm_ValidateSelectionDelegate(this.ValidateTargetScopeSelection));
    this._application.ObjectsLoaded += new Action<CApObjectsLoadedEventArgs>(this._application_ObjectsLoaded);
    this.InitializeComponent();
    this._isTargetScopeSelected = false;
    this._isProcessSelected = false;
  }

  private void CUiConsumeForm_Load(object sender, EventArgs e)
  {
    this._txObjEditBoxCtrl.Focus();
    this._txObjEditBoxCtrl.SetValidator(this._pickValidator);
    this._txObjEditBoxCtrl.Picked += new TxObjEditBoxCtrl_PickedEventHandler(this._txObjEditBoxCtrl_Picked);
    this._txObjEditBoxCtrl.TypeInvalid += new EventHandler(this._txObjEditBoxCtrl_TypeInvalid);
    this._txObjEditBoxCtrl.TypeValid += new EventHandler(this._txObjEditBoxCtrl_TypeValid);
    this._txObjEditBoxCtrl.ListenToPick = true;
    ((Control) this._txObjEditBoxCtrlTargetScope).Visible = this._resourcesMode;
    this._labelTargetScope.Visible = this._resourcesMode;
    if (this._resourcesMode)
    {
      this._txObjEditBoxCtrlTargetScope.SetValidator(this._targetScopeValidator);
      this._txObjEditBoxCtrlTargetScope.TypeInvalid += new EventHandler(this._txObjEditBoxCtrlTargetScope_TypeInvalid);
      this._txObjEditBoxCtrlTargetScope.TypeValid += new EventHandler(this._txObjEditBoxCtrlTargetScope_TypeValid);
      this._txObjEditBoxCtrlTargetScope.Picked += new TxObjEditBoxCtrl_PickedEventHandler(this._txObjEditBoxCtrlTargetScope_Picked);
    }
    else
    {
      int num = this._labelObjectsForConsumption.Location.Y - this._labelTargetScope.Location.Y;
      Label objectsForConsumption = this._labelObjectsForConsumption;
      Point location = this._labelObjectsForConsumption.Location;
      int x1 = location.X;
      location = this._labelTargetScope.Location;
      int y1 = location.Y;
      Point point1 = new Point(x1, y1);
      objectsForConsumption.Location = point1;
      TxFlexGrid txFlexGrid1 = this._txFlexGrid;
      location = ((Control) this._txFlexGrid).Location;
      int x2 = location.X;
      location = ((Control) this._txFlexGrid).Location;
      int y2 = location.Y - num;
      Point point2 = new Point(x2, y2);
      ((Control) txFlexGrid1).Location = point2;
      TxFlexGrid txFlexGrid2 = this._txFlexGrid;
      Size size1 = ((Control) this._txFlexGrid).Size;
      int width = size1.Width;
      size1 = ((Control) this._txFlexGrid).Size;
      int height = size1.Height + num;
      Size size2 = new Size(width, height);
      ((Control) txFlexGrid2).Size = size2;
    }
    ((C1FlexGridBase) this._txFlexGrid).AllowEditing = false;
    ((C1FlexGridBase) this._txFlexGrid).ExtendLastCol = true;
    ((C1FlexGridBase) this._txFlexGrid).AllowFiltering = true;
    ((C1FlexGridBase) this._txFlexGrid).SelectionMode = (SelectionModeEnum) 3;
    ((C1FlexGridBase) this._txFlexGrid).FocusRect = (FocusRectEnum) 0;
    if (!this.FlatStyleEnabled)
      ((C1FlexGridBase) this._txFlexGrid).Styles.EmptyArea.BackColor = SystemColors.Window;
    this.InitObjectsToConsumeGrid();
    this.AddResultObjects();
    this.ClearSelection();
    this.UpdateOkButton();
    ((C1FlexGridBase) this._txFlexGrid).SelChange += new EventHandler(this._txFlexGrid_SelChange);
  }

  private void _application_ObjectsLoaded(CApObjectsLoadedEventArgs args)
  {
    if (!args.IsConsumption)
      return;
    ((Control) this).Cursor = Cursors.Default;
    this._txObjEditBoxCtrl.Enabled = true;
    ((Control) this._txFlexGrid).Enabled = true;
    TxTcImportResultEx importResult = args.ImportResult;
    if (importResult != null)
    {
      List<ITxObject> notAssignedObjects = new List<ITxObject>();
      List<ITxObject> alreadyAssignedObjects = new List<ITxObject>();
      if (args.LoadedForPreview)
      {
        TxObjectList targetScope = this.CopyObjectsToTargetScope(importResult);
        if (this._txObjEditBoxCtrl.Object != null)
          notAssignedObjects = this.AssignObjectsToProcess(targetScope, ref alreadyAssignedObjects);
      }
      else
      {
        IEnumerable<ITxObject> itxObjects1 = importResult.LoadedObjects.Select<TxTcResultObjectDataEx, ITxObject>((Func<TxTcResultObjectDataEx, ITxObject>) (x => x.Object));
        IEnumerable<ITxObject> itxObjects2 = importResult.ExistingObjects.Select<TxTcResultObjectDataEx, ITxObject>((Func<TxTcResultObjectDataEx, ITxObject>) (x => x.Object));
        TxObjectList objectsForAssign = new TxObjectList();
        ((TxObjectList<ITxObject>) objectsForAssign).AddRange(new TxObjectList<ITxObject>(itxObjects1));
        ((TxObjectList<ITxObject>) objectsForAssign).AddRange(new TxObjectList<ITxObject>(itxObjects2));
        notAssignedObjects = this.AssignObjectsToProcess(objectsForAssign, ref alreadyAssignedObjects);
      }
      ((Control) this).Visible = false;
      if (alreadyAssignedObjects.Count<ITxObject>() > 0 || importResult.NotLoadedObjects.Count<TxTcResultObjectDataEx>() > 0 || notAssignedObjects.Count > 0)
      {
        this.ShowErrorLog(importResult.ExistingObjects.Where<TxTcResultObjectDataEx>((Func<TxTcResultObjectDataEx, bool>) (x => alreadyAssignedObjects.Contains(x.Object))), importResult.NotLoadedObjects, (IEnumerable<ITxObject>) notAssignedObjects);
        TxErrorStackDlg.DisplayErrors();
      }
      else
      {
        int num = (int) TxMessageBox.Show(AssignDataFromTCResources.SUCCESS_CONSUMPTION, AssignDataFromTCResources.CMD_NAME, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
      }
    }
    else if (!args.LoadedForPreview)
    {
      ((Control) this).Visible = false;
      int num = (int) TxMessageBox.Show(AssignDataFromTCResources.ERROR_CONSUMPTION_FAILED, AssignDataFromTCResources.CMD_NAME, MessageBoxButtons.OK, MessageBoxIcon.Hand);
      TxErrorStackDlg.DisplayErrors();
    }
    ((Form) this).Close();
  }

  private TxObjectList CopyObjectsToTargetScope(TxTcImportResultEx importResult)
  {
    List<ITxObject> itxObjectList = new List<ITxObject>();
    TxObjectList targetScope = new TxObjectList();
    if (this._txObjEditBoxCtrlTargetScope.Object is ITxObjectCollection objectCollection && this._resourcesMode)
    {
      IEnumerable<ITxObject> itxObjects1 = importResult.LoadedObjects.Select<TxTcResultObjectDataEx, ITxObject>((Func<TxTcResultObjectDataEx, ITxObject>) (x => x.Object));
      IEnumerable<ITxObject> itxObjects2 = importResult.ExistingObjects.Select<TxTcResultObjectDataEx, ITxObject>((Func<TxTcResultObjectDataEx, ITxObject>) (x => x.Object));
      TxObjectList txObjectList = new TxObjectList();
      ((TxObjectList<ITxObject>) txObjectList).AddRange(new TxObjectList<ITxObject>(itxObjects1));
      ((TxObjectList<ITxObject>) txObjectList).AddRange(new TxObjectList<ITxObject>(itxObjects2));
      targetScope = objectCollection.Paste(txObjectList);
    }
    return targetScope;
  }

  private bool IsAlreadyAssigned(ITxObject obj, TxPlanningOperation planningOperation)
  {
    bool flag = false;
    if (planningOperation != null)
    {
      ITxPlanningObject itxPlanningObject = (ITxPlanningObject) null;
      if (obj is ITxProcessModelObject processModelObject)
        itxPlanningObject = processModelObject.PlanningRepresentation;
      if (itxPlanningObject != null)
      {
        TxObjectList txObjectList = !this._resourcesMode ? planningOperation.AssignedParts : planningOperation.AssignedResources;
        if (txObjectList != null && ((Collection<ITxObject>) txObjectList).Contains((ITxObject) itxPlanningObject))
          flag = true;
      }
    }
    return flag;
  }

  private List<ITxObject> AssignObjectsToProcess(
    TxObjectList objectsForAssign,
    ref List<ITxObject> alreadyAssigned)
  {
    List<ITxObject> process = new List<ITxObject>();
    alreadyAssigned = new List<ITxObject>();
    if (this._txObjEditBoxCtrl.Object is ITxProcessModelObject processModelObject && processModelObject.PlanningRepresentation is TxPlanningOperation planningRepresentation)
    {
      foreach (ITxObject itxObject in (Collection<ITxObject>) objectsForAssign)
      {
        if (this._resourcesMode)
        {
          if (this.IsAlreadyAssigned(itxObject, planningRepresentation))
            alreadyAssigned.Add(itxObject);
          else if (planningRepresentation.CanAssignResource(itxObject))
            planningRepresentation.AssignResource(itxObject);
          else
            process.Add(itxObject);
        }
        else if (this.IsAlreadyAssigned(itxObject, planningRepresentation))
          alreadyAssigned.Add(itxObject);
        else if (planningRepresentation.CanAssignPart(itxObject))
          planningRepresentation.AssignPart(itxObject);
        else
          process.Add(itxObject);
      }
    }
    return process;
  }

  private void _buttonOK_Click(object sender, EventArgs e)
  {
    this._txObjEditBoxCtrl.Enabled = false;
    ((Control) this._txFlexGrid).Enabled = false;
    ((Control) this).Cursor = Cursors.WaitCursor;
    this._isProcessSelected = this._txObjEditBoxCtrl.Object != null;
    this._isTargetScopeSelected = this._txObjEditBoxCtrlTargetScope.Object != null;
    if (this._isTargetScopeSelected)
    {
      // ISSUE: explicit non-virtual call
      __nonvirtual (((Control) this).BeginInvoke((Delegate) new Action<bool, IEnumerable<CUiSearchResultObject>, bool>(this._application.LoadObjects), (object) true, (object) this._objectsForConsumption, (object) true));
    }
    else
    {
      if (!this._isProcessSelected)
        return;
      // ISSUE: explicit non-virtual call
      __nonvirtual (((Control) this).BeginInvoke((Delegate) new Action<bool, IEnumerable<CUiSearchResultObject>, bool>(this._application.LoadObjects), (object) false, (object) this._objectsForConsumption, (object) true));
    }
  }

  private void ShowErrorLog(
    IEnumerable<TxTcResultObjectDataEx> alreadyAssignedObjects,
    IEnumerable<TxTcResultObjectDataEx> notLoadedObjects,
    IEnumerable<ITxObject> notAssignedObjects)
  {
    Hashtable hashtable1 = new Hashtable();
    Hashtable hashtable2 = new Hashtable();
    bool flag = false;
    List<string> stringList = new List<string>();
    if (this._isProcessSelected)
    {
      foreach (TxTcResultObjectDataEx alreadyAssignedObject in alreadyAssignedObjects)
      {
        TxTcResultObjectDataEx alreadyLoadObject = alreadyAssignedObject;
        string property = this._objectsForConsumption.FirstOrDefault<CUiSearchResultObject>((Func<CUiSearchResultObject, bool>) (x => x.Uid == alreadyLoadObject.Uid)).GetProperty(CApPropertiesManager.BOM_LINE_NAME_PROPERTY);
        stringList.Add(property);
      }
      if (stringList.Count > 0)
      {
        hashtable1.Add((object) AssignDataFromTCResources.WARNING_ALREADY_CONSUMED, (object) stringList.ToArray());
        stringList = new List<string>();
        flag = true;
      }
    }
    foreach (TxTcResultObjectDataEx notLoadedObject1 in notLoadedObjects)
    {
      TxTcResultObjectDataEx notLoadedObject = notLoadedObject1;
      string property = this._objectsForConsumption.FirstOrDefault<CUiSearchResultObject>((Func<CUiSearchResultObject, bool>) (x => x.Uid == notLoadedObject.Uid)).GetProperty(CApPropertiesManager.BOM_LINE_NAME_PROPERTY);
      stringList.Add(property);
    }
    if (stringList.Count > 0)
    {
      hashtable2.Add((object) AssignDataFromTCResources.ERROR_FAILED_TO_LOAD_OBJECTS, (object) stringList.ToArray());
      stringList = new List<string>();
      flag = true;
    }
    foreach (ITxObject notAssignedObject in notAssignedObjects)
      stringList.Add(notAssignedObject.Name);
    if (stringList.Count > 0)
    {
      hashtable2.Add((object) AssignDataFromTCResources.ERROR_FAILED_TO_CONSUME_OBJECTS, (object) stringList.ToArray());
      flag = true;
    }
    if (!flag)
      return;
    TxErrorWindow.ShowDialog(AssignDataFromTCResources.CMD_NAME, AssignDataFromTCResources.ERROR_WINDOW_TITLE_CONSUMPTION, hashtable2, hashtable1, true);
  }

  private void _buttonCancel_Click(object sender, EventArgs e) => ((Form) this).Close();

  private void _txFlexGrid_SelChange(object sender, EventArgs e)
  {
    ((C1FlexGridBase) this._txFlexGrid).SelChange -= new EventHandler(this._txFlexGrid_SelChange);
    this.ClearSelection();
    ((C1FlexGridBase) this._txFlexGrid).SelChange += new EventHandler(this._txFlexGrid_SelChange);
  }

  private void InitObjectsToConsumeGrid()
  {
    foreach (CUiTCObjectProperty selectedProperty in this._selectedProperties)
    {
      this.AddColumn(selectedProperty.NiceName, selectedProperty.Name);
      if (selectedProperty.Name == CApPropertiesManager.BOM_LINE_NAME_PROPERTY)
        this.AddColumn(AssignDataFromTCResources.COLUMN_HEADER_SOURCE_STRUCTURE, "SourceStructureName");
    }
  }

  private Column AddColumn(string columnTitle, string columnName)
  {
    Column column = ((C1FlexGridBase) this._txFlexGrid).Cols.Add();
    column.Name = columnName;
    ((RowCol) column).UserData = (object) columnTitle;
    ((RowCol) column).AllowDragging = false;
    column.Caption = columnTitle;
    column.AllowSorting = true;
    return column;
  }

  private void AddResultObjects()
  {
    int count = ((RowColCollection) ((C1FlexGridBase) this._txFlexGrid).Rows).Count;
    foreach (CUiSearchResultObject searchResultObject in this._objectsForConsumption)
    {
      ((C1FlexGridBase) this._txFlexGrid).Rows.Add();
      int num1 = 0;
      foreach (CUiTCObjectProperty selectedProperty in this._selectedProperties)
      {
        if (selectedProperty.Name == CApPropertiesManager.BOM_LINE_NAME_PROPERTY)
        {
          ((C1FlexGridBase) this._txFlexGrid).SetCellImage(count, num1, searchResultObject.SourceObjectIcon);
          TxFlexGrid txFlexGrid1 = this._txFlexGrid;
          int num2 = count;
          int num3 = num1;
          int num4 = num3 + 1;
          string property = searchResultObject.GetProperty(selectedProperty.Name);
          ((C1FlexGridBase) txFlexGrid1)[num2, num3] = (object) property;
          ((C1FlexGridBase) this._txFlexGrid).SetCellImage(count, num4, searchResultObject.SourceScope.Image);
          TxFlexGrid txFlexGrid2 = this._txFlexGrid;
          int num5 = count;
          int num6 = num4;
          num1 = num6 + 1;
          string niceName = searchResultObject.SourceScope.NiceName;
          ((C1FlexGridBase) txFlexGrid2)[num5, num6] = (object) niceName;
        }
        else
          ((C1FlexGridBase) this._txFlexGrid)[count, num1++] = (object) searchResultObject.GetProperty(selectedProperty.Name);
      }
      ++count;
    }
    ((C1FlexGridBase) this._txFlexGrid).AutoSizeCols();
    ((C1FlexGridBase) this._txFlexGrid).AutoSizeRows();
  }

  private void ClearSelection()
  {
    foreach (Row row in (IEnumerable) ((C1FlexGridBase) this._txFlexGrid).Rows)
    {
      if (((RowCol) row).Selected)
        ((RowCol) row).Selected = false;
    }
  }

  private void UpdateOkButton()
  {
    string str;
    bool flag1 = this._pickValidator.IsValidObject(this._txObjEditBoxCtrl.Object, ref str);
    bool flag2 = this._targetScopeValidator.IsValidObject(this._txObjEditBoxCtrlTargetScope.Object, ref str);
    this._buttonOK.Enabled = this._resourcesMode ? flag1 | flag2 : flag1;
  }

  private void CUiConsumeForm_FormClosing(object sender, FormClosingEventArgs e)
  {
    this._application.ObjectsLoaded -= new Action<CApObjectsLoadedEventArgs>(this._application_ObjectsLoaded);
  }

  private void _txObjEditBoxCtrl_Picked(object sender, TxObjEditBoxCtrl_PickedEventArgs args)
  {
    this.UpdateOkButton();
  }

  private void _txObjEditBoxCtrl_TypeValid(object sender, EventArgs e) => this.UpdateOkButton();

  private void _txObjEditBoxCtrl_TypeInvalid(object sender, EventArgs e) => this.UpdateOkButton();

  private void _txObjEditBoxCtrlTargetScope_Picked(
    object sender,
    TxObjEditBoxCtrl_PickedEventArgs args)
  {
    this.UpdateOkButton();
  }

  private void _txObjEditBoxCtrlTargetScope_TypeValid(object sender, EventArgs e)
  {
    this.UpdateOkButton();
  }

  private void _txObjEditBoxCtrlTargetScope_TypeInvalid(object sender, EventArgs e)
  {
    this.UpdateOkButton();
  }

  private bool ValidateTargetProcessSelection() => this._txObjEditBoxCtrlTargetScope.Object == null;

  private bool ValidateTargetScopeSelection() => this._txObjEditBoxCtrl.Object == null;

  internal bool IsCompoundResourceRevisionTypePresentInTheConsumptionList()
  {
    foreach (CUiSearchResultObject searchResultObject in this._objectsForConsumption)
    {
      TxPlanningTypeMetaData typeMetaData = TxApplication.ActiveDocument.PlatformGlobalServicesProvider.GetTypeMetaData(searchResultObject.RevisionType);
      if (typeMetaData != null && typeMetaData.IsCompoundResourceRevisionSubType())
        return true;
    }
    return false;
  }

  internal bool AreConsumptionsValidAssignmentsForTarget(ITxObject target)
  {
    TxPlanningTypeMetaData typeMetaData1 = TxTcAuthoring.GetTypeMetaData(target);
    if (typeMetaData1 == null)
      return true;
    bool flag = true;
    foreach (CUiSearchResultObject searchResultObject in this._objectsForConsumption)
    {
      TxPlanningTypeMetaData typeMetaData2 = TxApplication.ActiveDocument.PlatformGlobalServicesProvider.GetTypeMetaData(searchResultObject.RevisionType);
      if (typeMetaData2 != null && !typeMetaData2.CanBeAssignedToType(typeMetaData1.TypeName))
      {
        if (TxCallMessages.IsCollecting())
          TxCallMessages.Add("APIMSG_CANNOT_ASSIGN_OBJECT_TO_OBJECT", new object[2]
          {
            (object) typeMetaData2.DisplayName,
            (object) typeMetaData1.DisplayName
          });
        flag = false;
      }
    }
    return flag;
  }

  internal bool AreConsumptionsValidChildsForTarget(ITxObject target)
  {
    TxPlanningTypeMetaData typeMetaData1 = TxTcAuthoring.GetTypeMetaData(target);
    if (typeMetaData1 == null)
      return true;
    bool flag = true;
    foreach (CUiSearchResultObject searchResultObject in this._objectsForConsumption)
    {
      TxPlanningTypeMetaData typeMetaData2 = TxApplication.ActiveDocument.PlatformGlobalServicesProvider.GetTypeMetaData(searchResultObject.RevisionType);
      if (typeMetaData2 != null && !typeMetaData2.CanBeChildOfType(typeMetaData1.TypeName))
      {
        if (TxCallMessages.IsCollecting())
          TxCallMessages.Add("APIMSG_CANNOT_ADD_OBJECT_BELOW_OBJECT", new object[2]
          {
            (object) typeMetaData2.DisplayName,
            (object) typeMetaData1.DisplayName
          });
        flag = false;
      }
    }
    return flag;
  }

  protected virtual void Dispose(bool disposing)
  {
    if (disposing && this.components != null)
      this.components.Dispose();
    base.Dispose(disposing);
  }

  private void InitializeComponent()
  {
    ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof (CUiConsumeForm));
    this._txObjEditBoxCtrl = new TxObjEditBoxCtrl();
    this.label1 = new Label();
    this._buttonOK = new Button();
    this._buttonCancel = new Button();
    this._txFlexGrid = new TxFlexGrid();
    this._labelObjectsForConsumption = new Label();
    this._txObjEditBoxCtrlTargetScope = new TxObjEditBoxCtrl();
    this._labelTargetScope = new Label();
    ((ISupportInitialize) this._txFlexGrid).BeginInit();
    ((Control) this).SuspendLayout();
    componentResourceManager.ApplyResources((object) this._txObjEditBoxCtrl, "_txObjEditBoxCtrl");
    this._txObjEditBoxCtrl.KeepFaceEmphasizedWhenControlIsNotFocused = true;
    this._txObjEditBoxCtrl.ListenToPick = true;
    ((Control) this._txObjEditBoxCtrl).Name = "_txObjEditBoxCtrl";
    this._txObjEditBoxCtrl.Object = (ITxObject) null;
    this._txObjEditBoxCtrl.PickAndClear = false;
    this._txObjEditBoxCtrl.PickLevel = (TxPickLevel) 1;
    this._txObjEditBoxCtrl.PickOnly = false;
    this._txObjEditBoxCtrl.ReadOnly = false;
    this._txObjEditBoxCtrl.ValidatorType = (TxValidatorType) 10;
    componentResourceManager.ApplyResources((object) this.label1, "label1");
    this.label1.Name = "label1";
    componentResourceManager.ApplyResources((object) this._buttonOK, "_buttonOK");
    this._buttonOK.Name = "_buttonOK";
    this._buttonOK.UseVisualStyleBackColor = true;
    this._buttonOK.Click += new EventHandler(this._buttonOK_Click);
    componentResourceManager.ApplyResources((object) this._buttonCancel, "_buttonCancel");
    this._buttonCancel.Name = "_buttonCancel";
    this._buttonCancel.UseVisualStyleBackColor = true;
    this._buttonCancel.Click += new EventHandler(this._buttonCancel_Click);
    componentResourceManager.ApplyResources((object) this._txFlexGrid, "_txFlexGrid");
    ((Control) this._txFlexGrid).Name = "_txFlexGrid";
    ((RowColCollection) ((C1FlexGridBase) this._txFlexGrid).Rows).Count = 1;
    componentResourceManager.ApplyResources((object) this._labelObjectsForConsumption, "_labelObjectsForConsumption");
    this._labelObjectsForConsumption.Name = "_labelObjectsForConsumption";
    componentResourceManager.ApplyResources((object) this._txObjEditBoxCtrlTargetScope, "_txObjEditBoxCtrlTargetScope");
    this._txObjEditBoxCtrlTargetScope.KeepFaceEmphasizedWhenControlIsNotFocused = true;
    this._txObjEditBoxCtrlTargetScope.ListenToPick = true;
    ((Control) this._txObjEditBoxCtrlTargetScope).Name = "_txObjEditBoxCtrlTargetScope";
    this._txObjEditBoxCtrlTargetScope.Object = (ITxObject) null;
    this._txObjEditBoxCtrlTargetScope.PickAndClear = false;
    this._txObjEditBoxCtrlTargetScope.PickLevel = (TxPickLevel) 1;
    this._txObjEditBoxCtrlTargetScope.PickOnly = false;
    this._txObjEditBoxCtrlTargetScope.ReadOnly = false;
    this._txObjEditBoxCtrlTargetScope.ValidatorType = (TxValidatorType) 1;
    componentResourceManager.ApplyResources((object) this._labelTargetScope, "_labelTargetScope");
    this._labelTargetScope.Name = "_labelTargetScope";
    ((Form) this).AcceptButton = (IButtonControl) this._buttonOK;
    componentResourceManager.ApplyResources((object) this, "$this");
    ((ContainerControl) this).AutoScaleMode = AutoScaleMode.Font;
    ((Control) this).Controls.Add((Control) this._labelTargetScope);
    ((Control) this).Controls.Add((Control) this._txObjEditBoxCtrlTargetScope);
    ((Control) this).Controls.Add((Control) this._labelObjectsForConsumption);
    ((Control) this).Controls.Add((Control) this._txFlexGrid);
    ((Control) this).Controls.Add((Control) this._buttonCancel);
    ((Control) this).Controls.Add((Control) this._buttonOK);
    ((Control) this).Controls.Add((Control) this.label1);
    ((Control) this).Controls.Add((Control) this._txObjEditBoxCtrl);
    ((Form) this).MaximizeBox = false;
    ((Form) this).MinimizeBox = false;
    ((Control) this).Name = nameof (CUiConsumeForm);
    ((Form) this).FormClosing += new FormClosingEventHandler(this.CUiConsumeForm_FormClosing);
    ((Form) this).Load += new EventHandler(this.CUiConsumeForm_Load);
    ((ISupportInitialize) this._txFlexGrid).EndInit();
    ((Control) this).ResumeLayout(false);
    ((Control) this).PerformLayout();
  }
}
